package com.mingqijia.gassafety.authority.api.web.facade;

import com.mingqijia.gassafety.authority.api.req.privilege.CreatePrivilegeReqDTO;
import com.mingqijia.gassafety.authority.api.req.privilege.QueryPrivilegeReqDTO;
import com.mingqijia.gassafety.authority.api.req.privilege.UpdatePrivilegeReqDTO;
import com.mingqijia.gassafety.authority.api.resp.privilege.PrivilegeRespDTO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;

/**
 * REST接口
 * @author Damon S.
 * @version v0.2
 * @date 2021-06-19
 */
@Api(tags = "控制台--权限")
@RequestMapping(value = "/console/v1/privileges", produces = MediaType.APPLICATION_JSON_VALUE)
public interface PrivilegeManageFacade {

    @GetMapping
    @ApiOperation(value = "查询权限", notes = "返回参数配置列表")
    List<PrivilegeRespDTO> findPrivilege(@Valid QueryPrivilegeReqDTO req);

    @PostMapping
    @ApiOperation(value = "创建权限", notes = "返回是否创建成功")
    String createPrivilege(@RequestBody@Valid CreatePrivilegeReqDTO req);

    @PutMapping
    @ApiOperation(value = "创建权限", notes = "返回是否创建成功")
    void updatePrivilege(@RequestBody@Valid UpdatePrivilegeReqDTO req);

    @DeleteMapping("/{privId}")
    @ApiImplicitParam(name = "privId", value = "权限Id", dataType = "String")
    @ApiOperation(value = "删除权限", notes = "返回是否删除成功")
    void removePrivilege(@PathVariable String privId);
}
